package com.aoxin.util.enumerate;

import com.aoxin.util.ErrorUtil;

public enum State {

    Succeed(1,"成功"),Fail(2,"失败");

    private Integer id;

    private String value;

    private State(Integer id,String value) {
        this.id = id;
        this.value=value;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    
    public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static Integer state(State state) {
        switch (state) {
            case Succeed:
                return 1;
            case Fail:
                return 2;
        }
        throw new RuntimeException(String.format(ErrorUtil.OPERATE_TYPE, state));
    }
}

